package com.assignwork.vo;

import com.assignwork.entity.WorkLineLog;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springblade.core.tool.utils.DateUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springblade.core.tool.utils.Func;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * (WorkLineLog)VO
 * @since 2024-05-28 11:01:01
 */
@Data
@ApiModel(value = "WorkLineLogVO", description = "")
public class WorkLineLogVO  {

    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long planId;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long lineId;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long arrangeId;

    private Integer isTrim;

    private Integer isClear;

    @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
    @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
    private LocalDateTime trimBeginTime;

    @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
    @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
    private LocalDateTime trimEndTime;

    private String loadLog;

    private String fixedMachineLog;

    private String flowMachineLog;

    private String underMachineLog;

    private List<WorkLineLogInfoVO> info;
    private Map machine;
    private String sign;

    public String getEndTimeStr() {
        if (trimEndTime != null) {
            return DateUtil.format(trimEndTime, "HH:mm");
        }
        return "";
    }

    public String getBeginTimeStr() {
        if (trimBeginTime != null) {
            return DateUtil.format(trimBeginTime, "HH:mm");
        }
        return "";
    }

    public String getBeginEndTimeStr() {
        if (Func.isNotBlank(getBeginTimeStr()) && Func.isNotBlank(getEndTimeStr())) {
            return getBeginTimeStr() + "~" + getEndTimeStr();
        }
        return "";
    }

}

